This repository was archived by the owner on May 17, 2025. It is now read-only.
Draft
Conversation
Owner
|
I wonder if it's better to go ahead and delete the connection from ddb too. This patch works fine to overcome the runtime race condition that results in a needless error. I'm happy to land it if you don't want it to be a draft. |
Contributor
|
It would definitely make more sense to delete the connections and the subscriptions if they are gone. .catch(async (err) => {
if (err?.statusCode !== 410) throw err;
await server.models.connection.delete({ id: ConnectionId });
await server.models.subscription.delete({ id: `${ConnectionId}|${message.id}` });
console.warn('Connection already closed at API Gateway, deleting connection and related subscription');
};Although this still leaves the subscriptions in the ddb that are related to the connection but aren't posted to. |
Owner
|
Well the disconnect event will take care of them, and last but not least the TTL will do the final cleanup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's possible that an API Gateway subscription is already closed by the client when trying to publish. E.g.:
This PR adds a catch block that ignores a GoneException.
This will need further verification.